package Leetcode;

import NodeList.ListNode;

public class reverseList {
    public ListNode reverseList(ListNode head) {
        ListNode node = head;
        ListNode result = null;
        while (node != null){
            result = new ListNode(node.val, result);
            node = node.next;
        }
        return result;
    }
}
